package com.facemox.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.facemox.bean.GlobalParameter;

public interface GlobalParameterMapper {
	
	// 插入一条数据
    @Insert("INSERT INTO face_global_parameter(param_body) values(#{paramBody})")
    // 1、获取数据库自增ID，keyProperty：java对象的属性，keyColumn：数据库字段名称
    @Options(useGeneratedKeys=true,keyProperty="globalParameterId",keyColumn="global_parameter_id")
    int addGlobalParameter(GlobalParameter globalParameter);
    
    // 查找全部
    @Select("select * from face_global_parameter")
    @Results({
    	@Result(column = "global_parameter_id",property = "globalParameterId"),
    	@Result(column = "param_body",property = "paramBody")
    })
    GlobalParameter getGlobalParameter();
    
    // 根据id更新
    @Update("update face_global_parameter set param_body=#{paramBody}")
    int update(GlobalParameter globalParameter);
    
}
